package eic.muckup.garden;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.DatePicker;
import android.widget.TimePicker;

public class NewWaterPlanActivity extends Activity {
	
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.new_water_plan_view);
		TimePicker startTime = (TimePicker) findViewById(R.id.StartTimePicker);
		TimePicker endTime = (TimePicker) findViewById(R.id.EndTimePicker);
		startTime.setIs24HourView(true);
		endTime.setIs24HourView(true);
		
	}
	public void Save(View view){
		DatePicker date = (DatePicker) findViewById(R.id.newWaterPlan_datePicker);
		TimePicker startTime = (TimePicker) findViewById(R.id.StartTimePicker);
		TimePicker endTime = (TimePicker) findViewById(R.id.EndTimePicker);
		
		WateringCalendarClass m = new WateringCalendarClass();
		m.setDate("Date:	"+Integer.toString(date.getDayOfMonth())+"-"+Integer.toString(date.getMonth())+"-"+Integer.toString(date.getYear()));
		m.setWaterCalendarStartTime("Start time:	"+Integer.toString(startTime.getCurrentHour())+"."+Integer.toString(startTime.getCurrentMinute()));
		m.setWaterCalendarEndTime("End time:	"+Integer.toString(endTime.getCurrentHour())+"."+Integer.toString(endTime.getCurrentMinute()));
		
		Intent intent = new Intent();
		intent.setClass(this, WateringPlanerActivity.class);
		intent.putExtra("newWateringPlan", m);
		
		setResult(Activity.RESULT_OK,intent);
		finish();
		
	}
}
